#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int NN=2e6+4;
int a[NN],b[NN],n,k;
ll val[NN];
ll calc1(int x)
{
    int last=x;
    ll res=x*val[k-1];
    for(int i=k-2;i;i--)
    {
        last=min(a[i]-last,a[i-1]);
        res+=last*val[i];
    }
    return res;
}
ll calc2(int x)
{
    int last=x;
    ll res=x*val[n-k+2];
    for(int i=n-k+3;i<=n;i++)
    {
        last=min(a[i-1]-last,a[i]);
        res+=last*val[i];
    }
    return res;
}
void solve()
{
    scanf("%d%d",&n,&k);//tepan k=1!!!!!!!!
    for(int i=1;i<n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=k;i++)
        scanf("%d",&b[i]);
    a[0]=a[n]=1e9;
    for(int i=1;i<=n;i++)
    {
        val[i]=val[i-1];
        if(i<=k)
            val[i]+=b[i];
        if(i>n-k+1)
            val[i]-=b[i-(n-k)-1];
    }
    ll cnt=0;
    for(int i=k;i<=n-k+1;i++)
        cnt+=a[i];
    int l=0,r=min(a[k-1],a[k-2])/2;
    ll w[2];
    while(l<r)
    {
        int mid=l+(r-l)/2;
        if(calc1(mid*2)-mid*val[k]>=calc1(mid*2+2)-(mid+1)*val[k])
            r=mid;
        else
            l=mid+1;
    }
    w[0]=calc1(l*2)-l*val[k];
    l=0,r=(min(a[k-1],a[k-2])-1)/2;
    while(l<r)
    {
        int mid=l+(r-l)/2;
        if(calc1(mid*2+1)-mid*val[k]>=calc1(mid*2+3)-(mid+1)*val[k])
            r=mid;
        else
            l=mid+1;
    }
    w[1]=calc1(l*2+1)-l*val[k];
    l=0,r=min(a[n-k+1],a[n-k+2])/2;
    while(l<r)
    {
        int mid=l+(r-l)/2;
        if(calc2(mid*2)-mid*val[k]>=calc2(mid*2+2)-(mid+1)*val[k])
            r=mid;
        else
            l=mid+1;
    }
    ll maxx=max(w[0],w[1]-(cnt&1^1)*val[k])+calc2(l*2)-l*val[k];
    l=0,r=(min(a[n-k+1],a[n-k+2])-1)/2;
    while(l<r)
    {
        int mid=l+(r-l)/2;
        if(calc2(mid*2)-mid*val[k]>=calc2(mid*2+2)-(mid+1)*val[k])
            r=mid;
        else
            l=mid+1;
    }
    maxx=max(maxx,max(w[0],w[1]-val[k])+calc2(l*2+1)-l*val[k]);
    printf("%lld\n",cnt/2*val[k]*(n-k+1-k+1)+maxx);
}
int main()
{
    int t;
    scanf("%*d%d",&t);
    while(t--)
        solve();
    return 0;
}